package com.jlastu.dlxy_androidapp.view.setting;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Switch;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.jlastu.dlxy_androidapp.R;

public class PrivacyActivity extends AppCompatActivity {

    private Switch orderNumberProtectionSwitch;
    private Switch taoFriendCircleSwitch;
    private Switch recommendationManagementSwitch;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.privacy_settings);

        orderNumberProtectionSwitch = findViewById(R.id.switch_order_number_protection);
        taoFriendCircleSwitch = findViewById(R.id.switch_tao_friend_circle);
        recommendationManagementSwitch = findViewById(R.id.switch_recommendation_management);


        initListeners();
    }

    private void initListeners() {
        orderNumberProtectionSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
            String message = isChecked ? "已禁止" : "已开启";
            Toast.makeText(PrivacyActivity.this, message, Toast.LENGTH_SHORT).show();
        });

        taoFriendCircleSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
            String message = isChecked ? "已禁止" : "已开启";
            Toast.makeText(PrivacyActivity.this, message, Toast.LENGTH_SHORT).show();
        });
        recommendationManagementSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
            String message = isChecked ? "已禁止" : "已开启";
            Toast.makeText(PrivacyActivity.this, message, Toast.LENGTH_SHORT).show();
        });


    }

    public void openPrivacyPolicy(View view) {
        Intent intent = new Intent(this, PrivacyPolicyActivity.class);
        startActivity(intent);
    }
}